﻿using Caliburn.Micro;
using OPSYS_Schematic.UIInfrastructure;

namespace OPSYS_Schematic.Presentation.Parts
{
    [MenuPart(BaseMenu = WorkbenchName.LanguagePart)]
    //[Export(typeof(ILanguagePart))]
    public class EnglishPart : MenuPart, ILanguagePart
    {
        public EnglishPart()
            : base(WorkbenchName.EnglishPart)
        {
            IsCheckable = true;
        }

        public override void Execute()
        {
            IoC.Get<IResourceService>().ChangeLanguage("en-us");
            IoC.Get<IConfigurationService>()[this].SaveProperty<MenuPart>(this, i => i.IsChecked);
        }

        public override void OnAttached()
        {
            IoC.Get<IConfigurationService>()[this].LoadProperty<MenuPart>(this, i => i.IsChecked);
        }
    }
}